package com.uzai.console.service.feign;

import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.uzai.console.common.UzaiRespVo;
import com.uzai.console.dto.takebal.redpacket.RedPacketQuery;
import com.uzai.console.dto.takebal.usertakebal.UserTakeBalQuery;
import com.uzai.console.dto.tb.tborder.TbOrderQuery;
import com.uzai.console.dto.user.useraccdetail.UserAccDetailQuery;
import com.uzai.console.entity.RedPacket;
import com.uzai.console.entity.TbOrder;
import com.uzai.console.entity.UserAccDetail;
import com.uzai.console.entity.UserTakeBal;
import com.uzai.console.service.feign.dto.HistoryTbOrderOptDto;
import com.uzai.console.service.feign.impl.HistoryDataFeignFallbackFactory;
import com.uzai.console.vo.takebal.usertakebal.UserTakeBalReportVo;
import com.uzai.console.vo.tb.tborder.TbOrderReportVo;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.stereotype.Component;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestParam;

import java.math.BigDecimal;
import java.util.List;

/**
 * The interface History data feign service.
 *
 * @author mingyang.chen create in 2022/10/28 16:15
 */
@Component
@FeignClient(value = "history-data-handler", fallbackFactory = HistoryDataFeignFallbackFactory.class)
public interface HistoryDataFeignService {

    /**
     * Search list.
     *
     * @param tableSuffix the table suffix
     * @param param       the param
     * @return the list
     */
    @PostMapping("/tbOrder/search")
    UzaiRespVo<List<TbOrder>> searchTbHistoryOrder(@RequestParam("tableSuffix") String tableSuffix, @RequestBody TbOrderQuery param);

    /**
     * Search list.
     *
     * @param tableSuffix the table suffix
     * @param param       the param
     * @return the list
     */
    @PostMapping("/tbOrder/page")
    UzaiRespVo<Page<TbOrder>> pageTbHistoryOrder(@RequestParam("tableSuffix") String tableSuffix, @RequestBody TbOrderQuery param);

    /**
     * Gets tb order.
     *
     * @param tableSuffix the table suffix
     * @param id          the id
     * @param merId       the mer id
     * @return the tb order
     */
    @PostMapping("/tbOrder/get")
    UzaiRespVo<TbOrder> getTbOrder(@RequestParam("tableSuffix") String tableSuffix, @RequestParam("id") Long id, @RequestParam("merId") Long merId);

    /**
     * 淘宝统计
     * Gets tb statistics.
     *
     * @param tableSuffix the table suffix
     * @param param       the param
     * @return the tb order
     */
    @PostMapping("/tbOrder/statistics")
    UzaiRespVo<TbOrderReportVo> getTbOrderStatistics(@RequestParam("tableSuffix") String tableSuffix, @RequestBody TbOrderQuery param);

    /**
     * 修改订单状态
     *
     * @param merId
     * @param userId
     * @param filterStatus
     * @param setStatus
     * @return
     */
    @PostMapping("/tbOrder/status/edit")
    UzaiRespVo<Boolean> cleanOrderStatus(@RequestParam("merId") Long merId,
                                         @RequestParam("userId") Long userId,
                                         @RequestParam("filterStatus") Integer filterStatus,
                                         @RequestParam("setStatus") Integer setStatus);

    @PostMapping("/tbOrder/status/edit/batch")
    UzaiRespVo<?> editStatusBatch(@RequestParam("merId") Long merId,
                                  @RequestParam(value = "userId", required = false) Long userId,
                                  @RequestParam("filterStatus") List<Integer> filterStatus,
                                  @RequestParam("setStatus") Integer setStatus);

    @PostMapping("/tbOrder/edit")
    UzaiRespVo<Boolean> edit(@RequestParam("tableSuffix") String tableSuffix, @RequestBody HistoryTbOrderOptDto param);


    @PostMapping("/tbOrder/delete/param")
    UzaiRespVo<Boolean> deleteByParam(@RequestParam("tableSuffix") String tableSuffix, @RequestBody HistoryTbOrderOptDto param);

    /**
     * 查询提现列表
     *
     * @param tableSuffix      the table suffix
     * @param userTakeBalQuery the user take bal query
     * @return uzai resp vo
     */
    @PostMapping("/userTakeBal/search")
    UzaiRespVo<List<UserTakeBal>> searchTakeBalHistory(@RequestParam("tableSuffix") String tableSuffix, @RequestBody UserTakeBalQuery userTakeBalQuery);

    /**
     * 查询提现列表
     *
     * @param tableSuffix      the table suffix
     * @param userTakeBalQuery the user take bal query
     * @return uzai resp vo
     */
    @PostMapping("/userTakeBal/page")
    UzaiRespVo<Page<UserTakeBal>> pageTakeBalHistory(@RequestParam("tableSuffix") String tableSuffix, @RequestBody UserTakeBalQuery userTakeBalQuery);

    /**
     * 修改提现
     *
     * @param tableSuffix      the table suffix
     * @param userTakeBal the user take bal query
     * @return uzai resp vo
     */
    @PostMapping("/userTakeBal/edit")
    UzaiRespVo<Boolean> edit(@RequestParam("tableSuffix") String tableSuffix, @RequestBody UserTakeBal userTakeBal);

    /**
     * Gets take bal.
     *
     * @param tableSuffix the table suffix
     * @param id          the id
     * @param merId       the mer id
     * @return the take bal
     */
    @PostMapping("/userTakeBal/get")
    UzaiRespVo<UserTakeBal> getTakeBal(@RequestParam("tableSuffix") String tableSuffix, @RequestParam("id") Long id, @RequestParam("merId") Long merId);


    /**
     * 查询提现列表统计
     *
     * @param tableSuffix      the table suffix
     * @param userTakeBalQuery the user take bal query
     * @return uzai resp vo
     */
    @PostMapping("/userTakeBal/statistics")
    UzaiRespVo<UserTakeBalReportVo> searchTakeBalStatistics(@RequestParam("tableSuffix") String tableSuffix, @RequestBody UserTakeBalQuery userTakeBalQuery);

    /**
     * 查询红包列表
     *
     * @param tableSuffix    the table suffix
     * @param redPacketQuery the red packet query
     * @return uzai resp vo
     */
    @PostMapping("/redPacket/search")
    UzaiRespVo<List<RedPacket>> searchRedPacketHistory(@RequestParam("tableSuffix") String tableSuffix, @RequestBody RedPacketQuery redPacketQuery);

    /**
     * 查询红包列表
     *
     * @param tableSuffix    the table suffix
     * @param redPacketQuery the red packet query
     * @return uzai resp vo
     */
    @PostMapping("/redPacket/page")
    UzaiRespVo<Page<RedPacket>> pageRedPacketHistory(@RequestParam("tableSuffix") String tableSuffix, @RequestBody RedPacketQuery redPacketQuery);

    /**
     * Gets red packet.
     *
     * @param tableSuffix the table suffix
     * @param id          the id
     * @param merId       the mer id
     * @return the red packet
     */
    @PostMapping("/redPacket/get")
    UzaiRespVo<RedPacket> getRedPacket(@RequestParam("tableSuffix") String tableSuffix, @RequestParam("id") Long id, @RequestParam("merId") Long merId);

    /**
     * 查询红包统计
     *
     * @param tableSuffix    the table suffix
     * @param redPacketQuery the red packet query
     * @return uzai resp vo
     */
    @PostMapping("/redPacket/totalCount")
    UzaiRespVo<BigDecimal> searchRedPacketTotalCount(@RequestParam("tableSuffix") String tableSuffix, @RequestBody RedPacketQuery redPacketQuery);

    /**
     * 查询积分明细
     *
     * @param tableSuffix the table suffix
     * @param param       the param
     * @return uzai resp vo
     */
    @PostMapping("/userAccDetail/search")
    UzaiRespVo<Page<UserAccDetail>> searchAccDetail(@RequestParam("tableSuffix") String tableSuffix, @RequestBody UserAccDetailQuery param);
}
